<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
        <script src="./lib/vue.js"></script>
    </head>
    <body>
        <div id="app">
            <form action="">
                <div>
                    用户名：<input type="text" v-on:keyup.delete="clearContent" v-model="uname" />
                </div>
                <div>
                    密码：<input type="password" v-on:keyup.enter="handleSubmit" v-model="pwd" />
                </div>
                <div><input type="button" v-on:click="handleSubmit" value="提交" /></div>
            </form>
        </div>
        <script>
            var app = new Vue({
                el: '#app',
                data: {
                    uname: '',
                    pwd: ''
                },
                methods: {
                    handleSubmit: function() {
                        console.log(this.uname, this.pwd);
                    },
                    clearContent: function() {
                        this.uname = '';
                    }
                }
            });
        </script>
    </body>
</html>
